﻿using Bmz.Studio.Phone.Application;
using Bmz.Studio.Phone.Domain;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Bmz.Studio.Phone.Web.Controllers
{
    public class HomeController : Controller
    {
        IInformationService informationService = null;
        ITeamMemberService teamMemberService = null;

        public HomeController()
        {
            informationService = new InformationService();
            teamMemberService = new TeamMemberService();
        }

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Search()
        {
            return View();
        }

        public ActionResult List(string type)
        {
            ViewBag.Type = type;
            object result;
            switch (type)
            {
                case "Team":
                    result = teamMemberService.GetList();
                    break;
                default:
                    result = informationService.GetList(type);
                    break;
            }
            return PartialView(AppViewSettings.GetViewName("List", type), result);
        }

        public ActionResult Detail(string type, int id)
        {
            object result;
            switch (type)
            {
                case StructInformationType.Team:
                    result = teamMemberService.GetModel(id);
                    break;
                default:
                    result = informationService.GetModel(id);
                    break;
            }
            return PartialView(AppViewSettings.GetViewName("Detail", type), result);
        }
    }
}